package utils

import "github.com/gin-gonic/gin"

type Response struct {
	Code int         `json:"code"` // HTTP status code
	Msg  string      `json:"msg"`  // Response msg
	Data interface{} `json:"data"` // Response data
}

func RespSuccess(ctx *gin.Context, data interface{}) *Response {
	r := &Response{
		Code: 0,
		Msg:  "success",
		Data: data,
	}
	return r
}

func RespError(code int, msg string) *Response {
	r := &Response{
		Code: code,
		Msg:  msg,
		Data: nil,
	}
	return r
}
